<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JavaScript 对象访问器</title>
</head>
<body>
<p id="demo"></p>

<script>
  var person = {
    firstName: "Bill",
    lastName: "Gates",
    language: "en",
    get lang() {
      return this.language;
    }
  };
  //使用getter显示来自对象的数据
  document.getElementById("demo").innerHTML =
          person.lang;
</script>
</body>
</html>